<%--
  Created by IntelliJ IDEA.
  User: longhunpomie
  Date: 2023/1/16
  Time: 0:31
  To change this template use File | Settings | File Templates.
--%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%
    String basePath = request.getScheme() + "://" +
            request.getServerName() +
            ":" + request.getServerPort() +
            request.getContextPath() + "/";
    pageContext.setAttribute("basePath", basePath);
%>
<div class="navbar">
    <div class="navbar-inner">
        <div class="container-fluid">
            <a data-target=".navbar-responsive-collapse" data-toggle="collapse" class="btn btn-navbar"><span class="icon-bar"></span><span class="icon-bar"></span><span class="icon-bar"></span></a> <a href="${basePath}" class="brand" style="color: green">滁州学院博客</a>
            <div class="nav-collapse collapse navbar-responsive-collapse">
                <ul class="nav">
                    <li class="active">
                        <a href="${basePath}">主页</a>
                    </li>
                    <li>
                        <a href="${basePath}/tag/toClassification">分类</a>
                    </li>
                    <li>
                        <a href="${basePath}/ranklist/toRankList">排行榜</a>
                    </li>
                    <li>
                        <a href="${basePath}/user/toDynamic">动态</a>
                    </li>
                </ul>
                <ul class="nav pull-right">
                    <li>
                        <form class="form-search" action="${basePath}/blog/queryBlog">
                            <input class="input-medium search-query" type="text" name="blogName" placeholder="标题，作者，内容"/> <button type="submit" class="btn">查找</button>
                        </form>
                    </li>
                    <li>
                        <a onclick="B()">关于</a>
                    </li>
                    <li class="divider-vertical">
                    </li>
                    <li class="dropdown">
                        <c:if test="${not empty sessionScope.user}">
                            <a data-toggle="dropdown" class="dropdown-toggle">
                                <c:if test="${not empty sessionScope.user.headImg}">
                                    <img onclick="A()" src="${basePath}user/img?name=${sessionScope.user.name}" style="width: 50px;height:50px;border-radius: 50%;" alt="">
                                </c:if>
                                <c:if test="${empty sessionScope.user.headImg}">
                                    <img onclick="A()" src="static/img/defaultHeadImg3.png" style="width: 50px;height:50px;border-radius: 50%;" alt="">
                                </c:if>
                                    ${sessionScope.user.name}
                                <strong class="caret"></strong></a>
                        </c:if>
                        <c:if test="${empty sessionScope.user}">
                            <a data-toggle="dropdown" class="dropdown-toggle">登录和注册<strong class="caret"></strong></a>
                        </c:if>
                        <ul class="dropdown-menu">
                            <c:if test="${empty sessionScope.user}">
                                <li>
                                    <a href="${basePath}/user/toRegist">注册</a>
                                </li>
                                <li>
                                    <a href="${basePath}/user/toLogin">登录</a>
                                </li>
                            </c:if>
                            <c:if test="${not empty sessionScope.user}">
                                <li>
                                    <a href="${basePath}/user/toUpdateUserInfo">修改信息</a>
                                </li>
                                <li>
                                    <a href="${basePath}/blog/showMyBlog?userId=${sessionScope.user.id}">我的空间</a>
                                </li>
                                <li class="divider">
                                </li>
                                <li>
                                    <a href="${basePath}/blog/toCollection?userId=${sessionScope.user.id}">我的收藏</a>
                                </li>
                                <li>
                                    <a href="${basePath}/blog/toHistory?userId=${sessionScope.user.id}">历史记录</a>
                                </li>
                                <li>
                                    <a href="${basePath}/blog/toAddBlog?name=${sessionScope.user.name}">去写博客</a>
                                </li>
                                <li class="divider">
                                </li>
                                <li>
                                    <a href="${basePath}/user/logout">注销</a>
                                </li>
                            </c:if>
                        </ul>
                    </li>
                </ul>
            </div>

        </div>
    </div>
</div>
